<template>
    <Row :gutter="20">
        <Col span="12">
            <div id="wlLeftEchart" :style="{width: '80%', height: '300px'}"></div>
        </Col>
        <Col span="12">
            <div id="wlLeftEchart2" :style="{width: '80%', height: '300px'}"></div>
        </Col>
    </Row>
</template>

<script>
export default {
  name: 'echarts',
  mounted () {
    let option = {
      title: {
        text: '驾驶员风险排名',
        subtext: '风险值'
      },
      color: ['#3398DB'],
      tooltip: {
        trigger: 'axis',
        axisPointer: { // 坐标轴指示器，坐标轴触发有效
          type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
        }
      },
      grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
      },
      xAxis: [
        {
          type: 'category',
          data: ['驾驶员1', '驾驶员2', '驾驶员3', '驾驶员4', '驾驶员5', '驾驶员6', '驾驶员7'],
          axisTick: {
            alignWithLabel: true
          }
        }
      ],
      yAxis: [
        {
          type: 'value'
        }
      ],
      series: [
        {
          name: '直接访问',
          type: 'bar',
          barWidth: '60%',
          data: [10, 52, 200, 334, 390, 330, 220]
        }
      ]
    }
    let myChart = this.$echarts.init(document.getElementById('wlLeftEchart'))
    let myChart2 = this.$echarts.init(document.getElementById('wlLeftEchart2'))
    myChart.setOption(option)
    option.title = {
      text: '驾驶员隐患排名',
      subtext: '隐患值'
    }
    myChart2.setOption(option)
  }
}
</script>

<style scoped>

</style>
